from salesforce.models import *
SF_OBJECT_LIST= ['Account',
            'AccountContactRole',
            'Attachment',
            'Asset',
            'Case',
            'CaseComment',
            'Contact',
            'Lead',
            'Note',
            'Opportunity',
            'Releases',
            'Solution',
            'SelfServiceUser',
            'User',
            'Prodcut2',
            'ContactRole']

SF_OBJECT_REMOTE= [
                 "Case",
                 "Solution"
                 ]
SF_OBJECT_PICKLIST= [
                 "Case",
                 "Solution"
                 'Lead'
                 ]
def get_sf_obj(sf_object):
    if sf_object=='Account':obj=Account()
    elif sf_object=='AccountContactRole':obj=AccountContactRole()
    elif sf_object=='Attachment':obj=Attachment()
    elif sf_object=='Asset':obj=Asset()
    elif sf_object=='Case':obj=Case()
    elif sf_object=='CaseComment':obj=CaseComment()
    elif sf_object=='Contact':obj=Contact()
    elif sf_object=='Lead':obj=Lead()
    elif sf_object=='Note':obj=Note()
    elif sf_object=='Opportunity':obj=Opportunity()
    elif sf_object=='Releases':obj=Releases()
    elif sf_object=='Solution':obj=Solution() 
    elif sf_object=='SelfServiceUser':obj=SelfServiceUser()
    elif sf_object=='User':obj=SFUser()
    elif sf_object=='Prodcut2':obj=Prodcut2()
    elif sf_object=='ContactRole':obj=ContactRole()
    return obj
def update_local(sf_object,user,manual,reset=False):
    if sf_object=='all':
        for sfo in SF_OBJECT_LIST:
            obj=get_sf_obj(sfo)
            obj.update_local(user,manual,reset)
    else:
        obj=get_sf_obj(sf_object)
        obj.update_local(user,manual,reset)
def update_picklist(sf_object,user,manual):
    obj=get_sf_obj(sf_object)
    obj.update_picklist(user,manual)

def update_sf(sf_object,user,manual):
    obj=get_sf_obj(sf_object)
    obj.update_sf(user,manual)
